define([ 'app', "config", "jquery", "store", "report/js/directive/permission", "jquery.cookie" ], function(app,config,$,store) {
	app.controller('mainController', ["$q", "$scope", "$http", function($q, $scope, $http) {

	}]);

	var initPermissions = function(){
		var params = {
			//callback:'JSON_CALLBACK',
			JSESSIONID:JSESSIONID
		};
		var expire = store.get("permissionExpire");
		var permis = store.get("permissionStore");
		var cookie = JSESSIONID;
		if(!expire||!permis||expire!=cookie){
			$.ajax({
				url:config.ajaxUrlBase + "permission/getRights",
				data:params,
				dataType:"jsonp",
				success:function(response){
					if(response.code==1){
						store.set("permissionStore",response.data);
						store.set("permissionExpire",cookie);
					}else{
						store.remove("permissionStore");
						store.remove("permissionExpire");
					}
				},
				error:function(){
					store.remove("permissionStore");
					store.remove("permissionExpire");
				}
			});
		}
	}
	if(window.JSESSIONID){
		initPermissions();
	}

	angular.bootstrap(document, [ "app" ]);

	require(['js/menu'], function(){

	});
});
